/**
 * Copyright (c) 2024,  科泰集团教研团队
 * 版权所有，请勿侵权
 */
package com.ktjiaoyu.ktmall.utils;

import java.util.List;

/**
 * 分页工具类
 * @author 科泰集团教研团队
 * @createTime 2024-4-17 20:49:54
 * @lastModify 2024-4-17 20:49:54
 * @version 1.0.0
 */
public class Page<T> {

    private List<T> data ; // 分页数据

    private int pageNo = 1; // 当前页
    private int pageSize = 10; // 一页的大小
    private int totalCount;  // 总数据量
    private int totalPageCount; // 总页数

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        if(totalCount > 0){
            totalPageCount = totalCount % pageSize == 0
                    ? totalCount / pageSize
                    : totalCount / pageSize + 1;
        }
        this.totalCount = totalCount;

    }

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }
}
